-- One parser for all supported languages - finally!

if ( GetLocale() == "deDE" or GetLocale() == "enGB" or GetLocale() == "enUS" or GetLocale() == "frFR" or GetLocale() == "esES" or GetLocale() == "zhTW" or GetLocale() == "koKR" or GetLocale() == "zhCN") then

	function CEnemyCastBar_Gfind_Debuffs(arg1, event) --Gfind_Debuffs

		local stack = string.match(arg1, "(%(.+%))");
		if ( stack ) then -- check for something in brackets, delete whole part in brackets -- number will be pulled out in control for better performance
			arg1 = string.gsub(arg1, NECB_Stack_Catcher2, "");
		end

		local mob, spell = string.match(arg1, CEnemyCastBar_SPELL_AFFLICTED);
		if (spell) then
			if (CEnemyCastBar.bSpellBreaks) then
				if (NECB_SPELL_AFFLICTED_turnit) then
					NECB_interrupt_casting(mob, spell); -- spell interrupting idea from Lazarus
				else
					NECB_interrupt_casting(spell, mob); -- spell interrupting idea from Lazarus
				end
			end
			if (NECB_SPELL_AFFLICTED_turnit) then
				CEnemyCastBar_Control(spell, mob, "afflicted", nil, event, nil, stack);
			else
				CEnemyCastBar_Control(mob, spell, "afflicted", nil, event, nil, stack);
			end
			return;
		end

		if (NECB_BossDB_loaded) then -- only parse for self debuffs in Instances with BossDebuffs (bc of fragiles does not justify this)
			spell = string.match(arg1, CEnemyCastBar_SPELL_AFFLICTED2);
			if (spell) then

				local spell2 = string.match(spell, "'(.+)'");
				if (spell2) then
					spell = spell2;
				end -- remove "'" (deDE clients) because blizz is not consistent in adding these (AURAADDEDSELFHARMFUL vs. AURAAPPLICATIONADDEDSELFHARMFUL)

				if (NECB_SPELL_AFFLICTED2_turnit) then
					CEnemyCastBar_Control(spell, CECB_SELF1, "afflicted", nil, event, nil, stack);
				else
					CEnemyCastBar_Control(CECB_SELF1, spell, "afflicted", nil, event, nil, stack);
				end
				return;
			end
		end

		if (CEnemyCastBar.bSpellBreaks) then
			if event == "CHAT_MSG_SPELL_SELF_DAMAGE" then
				mob, spell = string.match(arg1, CEnemyCastBar_SPELL_INTERRUPTED);
				if (mob) then
					if (NECB_SPELL_INTERRUPTED_turnit) then
						NECB_interrupt_casting(" ", spell);
					else
						NECB_interrupt_casting(" ", mob);
					end
					return;
				end

			elseif event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE" then
				local interrupter;
				interrupter, mob, spell = string.match(arg1, CEnemyCastBar_SPELL_INTERRUPTED_OTHER);
				if (mob) then
					if (NECB_SPELL_INTERRUPTED_OTHER_turnit) then
						NECB_interrupt_casting(" ", spell);
					else
						NECB_interrupt_casting(" ", mob);
					end
					return;
				end
			end
		end

	end

end